<!DOCTYPE html>
<html lang="en">
  <head>
    <title>
        Java-Senior-设计模式 - rulerLwx Blog
      </title>
        <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    
    <meta name="theme-color" content="#000000" />
    
    <meta http-equiv="window-target" content="_top" />
    
    
    <meta name="description" content="工厂模式 工厂方法模式 定义：一个用于创建对象的接口，让子类决定实例化哪一个类。Factory Method使一个类的实例化延迟到其子类。 我的理解" />
    <meta name="generator" content="Hugo 0.73.0 with theme pure" />
    <title>Java-Senior-设计模式 - rulerLwx Blog</title>
    
    
    <link rel="stylesheet" href="https://rulerLwx.gitee.io/css/style.min.c4bc7071f132c964c2116bca53b392933f377e5ca7b7051ed245187c621a2d3e.css">
    
    <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async>
    <meta property="og:title" content="Java-Senior-设计模式" />
<meta property="og:description" content="工厂模式 工厂方法模式 定义：一个用于创建对象的接口，让子类决定实例化哪一个类。Factory Method使一个类的实例化延迟到其子类。 我的理解" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://rulerLwx.gitee.io/2017/07/java-senior-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" />
<meta property="article:published_time" content="2017-07-01T12:09:48+08:00" />
<meta property="article:modified_time" content="2017-07-01T12:09:48+08:00" />
<meta itemprop="name" content="Java-Senior-设计模式">
<meta itemprop="description" content="工厂模式 工厂方法模式 定义：一个用于创建对象的接口，让子类决定实例化哪一个类。Factory Method使一个类的实例化延迟到其子类。 我的理解">
<meta itemprop="datePublished" content="2017-07-01T12:09:48&#43;08:00" />
<meta itemprop="dateModified" content="2017-07-01T12:09:48&#43;08:00" />
<meta itemprop="wordCount" content="1615">



<meta itemprop="keywords" content="," /><meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Java-Senior-设计模式"/>
<meta name="twitter:description" content="工厂模式 工厂方法模式 定义：一个用于创建对象的接口，让子类决定实例化哪一个类。Factory Method使一个类的实例化延迟到其子类。 我的理解"/>

    <!--[if lte IE 9]>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
      <![endif]-->

    <!--[if lt IE 9]>
        <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
      <![endif]-->
  </head>

  
  

  <body class="main-center theme-black" itemscope itemtype="http://schema.org/WebPage"><header class="header" itemscope itemtype="http://schema.org/WPHeader">
    <div class="slimContent">
      <div class="navbar-header">
        <div class="profile-block text-center">
          <a id="avatar" href="https://gitee.com/rulerLwx" target="_blank">
            <img class="img-circle img-rotate" src="https://rulerLwx.gitee.io/avatar.png" width="200" height="200">
          </a>
          <h2 id="name" class="hidden-xs hidden-sm">rulerLwx</h2>
          <h3 id="title" class="hidden-xs hidden-sm hidden-md">thinking...</h3>
          <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i>Guangzhou, China</small>
        </div><div class="search" id="search-form-wrap">
    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="Search" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i
                        class="icon icon-search"></i></button>
            </span>
        </div>
        <div class="ins-search">
            <div class="ins-search-mask"></div>
            <div class="ins-search-container">
                <div class="ins-input-wrapper">
                    <input type="text" class="ins-search-input" placeholder="Type something..."
                        x-webkit-speech />
                    <button type="button" class="close ins-close ins-selectable" data-dismiss="modal"
                        aria-label="Close"><span aria-hidden="true">×</span></button>
                </div>
                <div class="ins-section-wrapper">
                    <div class="ins-section-container"></div>
                </div>
            </div>
        </div>
    </form>
</div>
        <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>
      <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
        <ul class="nav navbar-nav main-nav">
            <li class="menu-item menu-item-home">
                <a href="/">
                    <i class="icon icon-home-fill"></i>
                  <span class="menu-title">Home</span>
                </a>
            </li>
            <li class="menu-item menu-item-archives">
                <a href="/posts/">
                    <i class="icon icon-archives-fill"></i>
                  <span class="menu-title">Archives</span>
                </a>
            </li>
            <li class="menu-item menu-item-categories">
                <a href="/categories/">
                    <i class="icon icon-folder"></i>
                  <span class="menu-title">Categories</span>
                </a>
            </li>
            <li class="menu-item menu-item-tags">
                <a href="/tags/">
                    <i class="icon icon-tags"></i>
                  <span class="menu-title">Tags</span>
                </a>
            </li>
            <li class="menu-item menu-item-about">
                <a href="/about/">
                    <i class="icon icon-cup-fill"></i>
                  <span class="menu-title">About</span>
                </a>
            </li>
        </ul>
      </nav>
    </div>
  </header>

<aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">Board</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">enjoy~
            </div>
        </div>
    </div>
</div>

      <div class="widget">
    <h3 class="widget-title"> Categories</h3>
    <div class="widget-body">
        <ul class="category-list">
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-framework/" class="category-list-link">java-framework</a><span class="category-list-count">38</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-front-end/" class="category-list-link">java-front-end</a><span class="category-list-count">11</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-se/" class="category-list-link">java-se</a><span class="category-list-count">21</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/java-senior/" class="category-list-link">java-senior</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/linux/" class="category-list-link">linux</a><span class="category-list-count">13</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/tools/" class="category-list-link">tools</a><span class="category-list-count">1</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%8A%80%E6%9C%AF%E6%9D%82%E7%83%A9/" class="category-list-link">技术杂烩</a><span class="category-list-count">4</span></li>
            <li class="category-list-item"><a href="https://rulerLwx.gitee.io/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" class="category-list-link">数据库</a><span class="category-list-count">15</span></li>
        </ul>
    </div>
</div>
      <div class="widget">
    <h3 class="widget-title"> Tags</h3>
    <div class="widget-body">
        <ul class="tag-list">
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/jvm/" class="tag-list-link">jvm</a><span
                    class="tag-list-count">1</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/" class="tag-list-link">多线程</a><span
                    class="tag-list-count">2</span></li>
            
            
            <li class="tag-list-item"><a href="https://rulerLwx.gitee.io/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" class="tag-list-link">网络编程</a><span
                    class="tag-list-count">3</span></li>
            
        </ul>

    </div>
</div>
      
<div class="widget">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget-body">
        <ul class="recent-post-list list-unstyled no-thumbnail">
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E4%B8%80%E6%89%B9%E9%87%8F%E7%A7%BB%E5%8A%A8%E9%87%8D%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6/" class="title">自己动手（一）——批量移动、重命名文件</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-27 17:50:02 &#43;0800 CST" itemprop="datePublished">2020-07-27</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E5%85%B3%E4%BA%8Einteger%E7%9A%84-128~127%E7%BC%93%E5%AD%98/" class="title">关于Integer的 -128~127缓存</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-11 16:56:21 &#43;0800 CST" itemprop="datePublished">2020-07-11</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E8%B7%A8%E5%9F%9F%E9%97%AE%E9%A2%98/" class="title">跨域问题</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-08 22:41:12 &#43;0800 CST" itemprop="datePublished">2020-07-08</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/" class="title">个人博客搭建</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-05 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-05</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://rulerLwx.gitee.io/2020/07/mongodb-1/" class="title">MonggoDB-1</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-07-03 18:58:47 &#43;0800 CST" itemprop="datePublished">2020-07-03</time>
                    </p>
                </div>
            </li>
        </ul>
    </div>
</div>
  </div>
</aside>

    
    
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <h4 class="toc-title">Catalogue</h4>
    <nav id="toc" class="js-toc toc">

    </nav>
  </div>
</aside>
<main class="main" role="main"><div class="content">
  <article id="-" class="article article-type-" itemscope
    itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      <h1 itemprop="name">
  <a
    class="article-title"
    href="/2017/07/java-senior-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/"
    >Java-Senior-设计模式</a
  >
</h1>

      <div class="article-meta">
        
<span class="article-date">
  <i class="icon icon-calendar-check"></i>&nbsp;
<a href="https://rulerLwx.gitee.io/2017/07/java-senior-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" class="article-date">
  <time datetime="2017-07-01 12:09:48 &#43;0800 CST" itemprop="datePublished">2017-07-01</time>
</a>
</span>
<span class="article-category">
  <i class="icon icon-folder"></i>&nbsp;
  <a class="article-category-link" href="/categories/java-senior/"> Java-Senior </a>
</span>  
  <span class="article-tag">
    <i class="icon icon-tags"></i>&nbsp;
    <a class="article-tag-link" href="/tags//">  </a>
  </span>

        <span class="post-comment"><i class="icon icon-comment"></i>&nbsp;<a href="/2017/07/java-senior-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/#comments"
            class="article-comment-link">Comments</a></span>
		<span class="post-wordcount hidden-xs" itemprop="wordCount">Word Count: 1615words</span>
		<span class="post-readcount hidden-xs" itemprop="timeRequired">Read Count: 4minutes </span>
      </div>
    </div>
    <div class="article-entry marked-body js-toc-content" itemprop="articleBody">
      <h1 id="工厂模式">工厂模式</h1>
<h2 id="工厂方法模式">工厂方法模式</h2>
<p>定义：一个用于创建对象的接口，让子类决定实例化哪一个类。Factory Method使一个类的实例化延迟到其子类。</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020450.png" alt=""></p>
<p>我的理解：子类实现抽象方法时可以有不同的实现（new不同的对象，让子类决定创建对象）。这样就不用修改已经写的类中的逻辑了。</p>
<h2 id="抽象工厂模式">抽象工厂模式</h2>
<p>定义：提供一个创建一系列或相互依赖对象的接口，而无须指定它们具体的类。</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020519.png" alt=""></p>
<h2 id="两种模式的区别">两种模式的区别</h2>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020534.png" alt=""></p>
<h1 id="观察者模式">观察者模式</h1>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020608.png" alt=""></p>
<p>我的理解：在主题方有集合，用于保存订阅者列表。主题方有更新时，就会循环遍历集合中的观察者，并调用观察者的更新方法（update()）。</p>
<h1 id="装饰模式">装饰模式</h1>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020628.png" alt=""></p>
<p>作用：在不修改类的情况下给类增加新的功能。</p>
<p>具体组件和装饰者都是抽象组件的子类，因此装饰者本身也可以作为具体组件（即“被装饰者”）。装饰者中有具体组件的引用。</p>
<p>它的核心思想是：装饰者调用被装饰者的方法后，再执行装饰者自己的代码。</p>
<h1 id="命令模式">命令模式</h1>
<p>会看（画）类图，理解它们之间引用。</p>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020646.png" alt=""></p>
<p>我的理解：命令模式就是一种引用之间的调用关系。Invoker调用ConcreteCommad中的方法，ConcreteCommand再调用Receiver中的方法。</p>
<p>用面向对象方式来思考：指挥官，命令，士兵。指挥官不直接跟士兵接触，而是通过命令对象。</p>
<h1 id="迭代器模式">迭代器模式</h1>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020740.png" alt=""></p>
<p>我的理解：集合本身不迭代元素，而是交给一个专门的对象来执行，这个对象就是Iterator。因此Iterator就要有集合的引用，以便迭代集合。</p>
<h1 id="适配器模式">适配器模式</h1>
<h2 id="单向适配器">单向适配器</h2>
<p><img src="https://gitee.com/rulerLwx/PicGo/raw/master/img/20200708020803.png" alt=""></p>
<p>三个角色：<br>
1）目标（Target）<br>
2）被适配者（Adaptee）<br>
3）适配器（Adapter）：实现了目标接口，并有被适配者的引用</p>
<h2 id="双向适配器">双向适配器</h2>
<p>如果Adapter角色同时实现目标接口和被适配器接口，并包含目标和被适配者的引用，那么该适配器就是一个双向适配器。</p>
<h1 id="faq">FAQ</h1>
<p>113）适配器模式和装饰器模式有什么区别？(答案)<br>
虽然适配器模式和装饰器模式的结构类似，但是每种模式的出现意图不同。适配器模式被用于桥接两个接口，而装饰模式的目的是在不修改类的情况下给类增加新的功能。</p>
<p>114）适配器模式和代理模式之前有什么不同？(答案)<br>
这个问题与前面的类似，适配器模式和代理模式的区别在于他们的意图不同。由于适配器模式和代理模式都是封装真正执行动作的类，因此结构是一致的，但是适配器模式用于接口之间的转换，而代理模式则是增加一个额外的中间层，以便支持分配、控制或智能访问。</p>
<p>作者：Java团长
链接：http://www.jianshu.com/p/ca185fff7ccb
來源：简书
著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。</p>
<h1 id="附录a两个易混概念">附录A：两个易混概念</h1>
<p>面向对象中依赖、关联的实践概念：<br>
依赖：以方法入参或返回值形式。<br>
关联：以字段形式。</p>
<h1 id="附录b程序设计的几个原则">附录B：程序设计的几个原则</h1>
<p>1）面向抽象原则<br>
2）开-闭原则：让设计对扩展开放，对修改关闭。<br>
3）多用组合少用继承原则<br>
4）高内聚-低耦合原则</p>
<h1 id="附录c单例模式代码实现">附录C：单例模式代码实现</h1>
<h2 id="饿汉方式">饿汉方式</h2>
<pre><code class="language-java">public class HungryManSingleInstance {

    private HungryManSingleInstance(){}

    private static final HungryManSingleInstance instance = new HungryManSingleInstance();

    public HungryManSingleInstance getInstance(){
        return instance;
    }
}
</code></pre>
<h2 id="懒汉方式">懒汉方式</h2>
<pre><code class="language-java">public class LazyLoadSingleInstance {

    private static LazyLoadSingleInstance instance;

    private LazyLoadSingleInstance(){}

    public static LazyLoadSingleInstance getInstance() {
        if(instance == null){
            instance = new LazyLoadSingleInstance();
        }
        return instance;
    }
}
</code></pre>
<p><strong>懒汉方式线程不安全</strong>。若要安全，则使用双重锁方式（懒汉方式的安全版）。</p>
<h2 id="双重锁方式多线程环境">双重锁方式（多线程环境）</h2>
<pre><code class="language-java">public class DoubleLockSingleInstance {

    private volatile static DoubleLockSingleInstance singleton;

    private DoubleLockSingleInstance() {
    }

    public static DoubleLockSingleInstance getSingleton() {
        if (singleton == null) {
            synchronized (DoubleLockSingleInstance.class) {
                if (singleton == null) {
                    singleton = new DoubleLockSingleInstance();
                }
            }
        }
        return singleton;
    }
}
</code></pre>
<p>为什么要用双重锁？为了提高线程的访问效率：只要有一个线程实例化了一个对象，外面的线程就不需要再等待锁了。</p>
<p><img src="226C87252F2347C28B145A2145873F87" alt="image"></p>
<h2 id="静态内部类方式">静态内部类方式</h2>
<p>做到了延迟加载，因为调用getInstance()时才创建实例。（有疑问）。</p>
<p>经测试，是可以延迟的。结论：静态内部类的静态变量只有在所在的内部类被调用时才初始化。</p>
<pre><code class="language-java">public class StaticSingleInstance {

    private StaticSingleInstance(){
        System.out.println(&quot;静态方式创建单例的外部类无参构造器被调用了&quot;);
    }

    public static class SingleInnerHolder{
        public static StaticSingleInstance instance = 
                new StaticSingleInstance();
    }

    public static StaticSingleInstance getInstance(){
        return SingleInnerHolder.instance;
    }
}
</code></pre>
<h2 id="枚举类方式">枚举类方式</h2>
<p>单例的定义：</p>
<pre><code class="language-java">public enum EnumSingleInstance {

    INSTANCE;

    private EnumSingleInstanceClass instance;

    EnumSingleInstance() {
        instance = new EnumSingleInstanceClass();
    }

    public EnumSingleInstanceClass getInstance() {
        return instance;
    }
}
</code></pre>
<p>客户端的调用：</p>
<pre><code class="language-java">public class EnumSingleInstanceTest {
    @Test
    public void testGetInstance() {
        for (int i = 0; i &lt; 10; i++) {
            EnumSingleInstanceClass instance = EnumSingleInstance.INSTANCE
                    .getInstance();
            System.out.println(instance);
        }
    }
}
</code></pre>

    </div>
    <div class="article-footer">
<blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    <li class="post-copyright-link hidden-xs">
      <strong>Permalink: </strong>
      <a href="https://rulerLwx.gitee.io/2017/07/java-senior-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/" title="Java-Senior-设计模式" target="_blank" rel="external">https://rulerLwx.gitee.io/2017/07/java-senior-%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/</a>
    </li>
    <li class="post-copyright-license">
      <strong>License：</strong><a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN</a>
    </li>
  </ul>
</blockquote>

<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://gitee.com/rulerLwx" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="https://rulerLwx.gitee.io/avatar.png" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://gitee.com/rulerLwx" target="_blank"><span class="text-dark">rulerLwx</span><small class="ml-1x">thinking...</small></a></h3>
        <div>Good Good Study, Day Day Up~</div>
      </div>
    </figure>
  </div>
</div>
    </div>
  </article>
<section id="comments">
    <div id="vcomments"></div>
</section>

</div><nav class="bar bar-footer clearfix" data-stick-bottom>
    <div class="bar-inner">
        <ul class="pager pull-left">
            <li class="prev">
                <a href="https://rulerLwx.gitee.io/2017/07/java-senior-%E6%97%A5%E5%BF%97/" title="Java-Senior-日志"><i
                        class="icon icon-angle-left"
                        aria-hidden="true"></i><span>&nbsp;&nbsp;Older</span></a>
            </li>
            <li class="next">
                <a href="https://rulerLwx.gitee.io/2017/07/java-se-java8/"
                    title="Java-Se-Java8"><span>Newer&nbsp;&nbsp;</span><i
                        class="icon icon-angle-right" aria-hidden="true"></i></a>
            </li>
            
            <li class="toggle-toc">
                <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false"
                    title="Catalogue" role="button">
                    <span>[&nbsp;</span><span>Catalogue</span>
                    <i class="text-collapsed icon icon-anchor"></i>
                    <i class="text-in icon icon-close"></i>
                    <span>]</span>
                </a>
            </li>
        </ul>
        <div class="bar-right">
            <div class="share-component" data-sites="weibo,qq,wechat"
                data-mobile-sites="weibo,qq,qzone"></div>
        </div>
    </div>
</nav>

</main><footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
<ul class="social-links">
    <li><a href="https://gitee.com/rulerLwx" target="_blank" title="gitee" data-toggle=tooltip data-placement=top >
            <i class="icon icon-gitee"></i></a></li>
    <li><a href="https://github.com/wolf-lea" target="_blank" title="github" data-toggle=tooltip data-placement=top >
            <i class="icon icon-github"></i></a></li>
</ul>
  <div class="copyright">
    &copy;2017  -
    2020
    <div class="publishby">
        Theme by <a href="https://github.com/xiaoheiAh" target="_blank"> xiaoheiAh </a>base on<a href="https://github.com/xiaoheiAh/hugo-theme-pure" target="_blank"> pure</a>.
    </div>
  </div>
</footer>

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_SVG"></script>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
            showMathMenu: false, //disables context menu
            tex2jax: {
            inlineMath: [ ['$','$'], ['\\(','\\)'] ]
           }
    });
</script>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script>
    window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js"></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/python.min.js" defer></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/javascript.min.js" defer></script><script>
    hljs.configure({
        tabReplace: '    ', 
        classPrefix: ''     
        
    })
    hljs.initHighlightingOnLoad();
</script>
<script src="https://rulerLwx.gitee.io/js/application.min.bdeb64b910570b6c41badc6a05b7afb0c8ad9efd8525de3c7257d59e786326a3.js"></script>
<script src="https://rulerLwx.gitee.io/js/plugin.min.51ff8c7317566f82259170fa36e09c4493adc9b9378b427a01ad3f017ebac7dd.js"></script>

<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: 'Posts',
                PAGES: 'Pages',
                CATEGORIES: 'Categories',
                TAGS: 'Tags',
                UNTITLED: '(Untitled)',
            },
            ROOT_URL: 'https:\/\/rulerLwx.gitee.io',
            CONTENT_URL: 'https:\/\/rulerLwx.gitee.io\/searchindex.json ',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script type="text/javascript" src="https://rulerLwx.gitee.io/js/insight.min.a343cd9a5a7698336b28ef3a7c16a3a1b1d2d5fb17dc8ed04022bbe08cc5459073a15bdafa3a8a58cdd56080784bdd69fa70b1ae8597565c799c57ed00f0e120.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
<script>
    tocbot.init({
        
        tocSelector: '.js-toc',
        
        contentSelector: '.js-toc-content',
        
        headingSelector: 'h1, h2, h3',
        
        hasInnerContainers: true,
    });
</script>

<script src="https://cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine"></script>
<script type="text/javascript">
    var GUEST = ['nick', 'mail', 'link'];
    var meta = 'nick,mail';
    meta = meta.split(',').filter(function (item) {
        return GUEST.indexOf(item) > -1;
    });
    new Valine({
        el: '#vcomments',
        verify: null ,
        notify: null ,
        appId: 'IyAB0PSPRazTPDxitO1ddQ7O-gzGzoHsz',
        appKey: '5rBJTq4KidYF33eXwvRVhtEH',
        placeholder: 'enjoy~',
        avatar: 'mm',
        meta: meta,
        pageSize: '10' || 10,
        visitor: false 
});
</script>

  </body>
</html>
